//
//  MySearchSingleSongTableViewCell.m
//  TTMusic
//
//  Created by yanghuiyan on 16/4/5.
//  Copyright © 2016年 cpy. All rights reserved.
//

#import "MySearchSingleSongTableViewCell.h"

@implementation MySearchSingleSongTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
       
        self.numLabel = [TTMusicBaseLabel new];
        _numLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_numLabel];
        
        self.songLabel = [TTMusicBaseLabel new];
        [self.contentView addSubview:_songLabel];
        
        self.singerLabel = [TTMusicBaseLabel new];
        [self.contentView addSubview:_singerLabel];
        
        _pullButton = [UIButton buttonWithType:UIButtonTypeSystem];
//        _pullButton.frame = CGRectZero;
//        _pullButton.backgroundColor = [UIColor redColor];
//        [_pullButton setImage:[[UIImage imageNamed:@"pull"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ] forState:UIControlStateNormal];
//        [self.contentView addSubview:_pullButton];
        
        
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [_numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(self.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(70, Height - 10));
        make.left.mas_equalTo(self.contentView).offset(10);
        
    }];
    
    [_songLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.contentView).offset(10);
        make.left.mas_equalTo(self.contentView).offset(85);
        make.size.mas_equalTo(CGSizeMake(200, 30));
        
    }];
    
    [_singerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_songLabel.mas_bottom).offset(5);
        make.left.mas_equalTo(_numLabel.mas_right).offset(5);
        make.size.mas_equalTo(CGSizeMake(200, 20));
        
    }];

//    [_pullButton mas_makeConstraints:^(MASConstraintMaker *make) {
//        
//        make.centerY.equalTo(self.mas_centerY);
//        make.size.mas_equalTo(CGSizeMake(30, 30));
//        make.right.mas_equalTo(self.contentView).offset(-20);
//        
//    }];
    
}

- (void)setSongModel:(SearchSongDataModel *)songModel {
    _songModel = songModel;
//    if (songModel.name) {
    
        _songLabel.text = songModel.name;
//    }
    _singerLabel.text = [NSString stringWithFormat:@"%@ ❤️ %@", songModel.singerName, songModel.favorites];
    
    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
